package com.codeforces.contest.c299;

import java.util.Scanner;

public class _299A {

	static Scanner scanner = new Scanner(System.in);
	static int n, mv;
	static int[] num;
	
	public static void main(String[] args) {
		n = scanner.nextInt();
		num = new int[n];
		mv = 1000000001;
		for (int i=0;i<n;++i) {
			num[i] = scanner.nextInt();
			if (num[i] < mv) {
				mv = num[i];
			}
		}
		for (int i=0;i<n;++i) {
			if (num[i] % mv != 0) {
				System.out.println(-1);
				return;
			}
		}
		System.out.println(mv);
	}

}
